package com.homework.printer;
//组装打印机
public class Printers {
    private Papers papers;
    private Inks inks;

    public Printers(Papers papers, Inks inks) {
        this.papers = papers;
        this.inks = inks;
    }

    public Printers() {
    }

    public Papers getPapers() {
        return papers;
    }

    public void setPapers(Papers papers) {
        this.papers = papers;
    }

    public Inks getInks() {
        return inks;
    }

    public void setInks(Inks inks) {
        this.inks = inks;
    }
    public String print(String content){
        for (int i = 0; i < content.length(); i++) {
            char cha = content.charAt(i);
            if (i != 0 && i % this.papers.getSize() == 0){
                System.out.println();
            }
            this.inks.getColor().print(cha);
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return content;
    }
}
